require("glon");

AddCSLuaFile("libraries/sh_class.lua");
AddCSLuaFile("config.lua");
AddCSLuaFile("shared.lua");
AddCSLuaFile("libraries/cl_util.lua");
AddCSLuaFile("cl_init.lua");
AddCSLuaFile("libraries/sh_player.lua");
AddCSLuaFile("libraries/panels/scoreboard.lua");

include("shared.lua");
include("libraries/sh_class.lua");
include("libraries/sv_player.lua");
include("config.lua");
include("libraries/sv_commands.lua");
include("libraries/sh_player.lua");

function GM:PlayerInitialSpawn(player)
	self.BaseClass:PlayerInitialSpawn(player);
	
	player:SetTeam(1);
	player.classid = "citizen";
end;

function GM:PlayerSpawn(player)
	self.BaseClass:PlayerSpawn(player);
	
	local walkSpeed, runSpeed = self:GetConfig("walkSpeed"), self:GetConfig("runSpeed");
	
	self:SetPlayerSpeed(player, walkSpeed, runSpeed);
	
	player:SetNWBool("lgtrp_holstered", false);
end;

function GM:PlayerLoadout(player)
	local default = self:GetConfig("defaultWeapons");
	local class = self:GetClassData(player.classid);
	
	player:RemoveAllAmmo();
	
	for k, v in pairs(default) do
		player:Give(v);
	end;
	
	if (class.weapons) then
	end;
end;

function GM:PlayerSpawnObject(player)
	return true;
end;

function GM:PlayerSpawnRagdoll(player, model, entity)
	local limit = player:ReachedSandboxLimit("RAGDOLLS");
	local restricted = table.HasValue(self:GetConfig("bannedProps"), model);
	
	if (restricted) then
		player:PrintMessage(HUD_PRINTTALK, "This ragdoll is banned.");
		return false;
	end;
	
	return !limit;
end;

function GM:PlayerSpawnProp(player, model)
	local limit = player:ReachedSandboxLimit("PROPS");
	local restricted = table.HasValue(self:GetConfig("bannedProps"), model);
	
	if (restricted) then
		player:PrintMessage(HUD_PRINTTALK, "This prop is banned.");
		return false;
	end;
	
	return !limit;
end;

function GM:PlayerSpawnEffect(player, model)
	local limit = player:ReachedSandboxLimit("EFFECTS");
	local restricted = table.HasValue(self:GetConfig("bannedProps"), model);
	
	if (restricted) then
		player:PrintMessage(HUD_PRINTTALK, "This effect is banned.");
		return false;
	end;
	
	return !limit;
end;

function GM:PlayerSpawnVehicle(player, model, name, vehicleTable)
	return false;
end;

function GM:PlayerSpawnSWEP(player, name, weaponTable)
	return false;
end;

function GM:PlayerGiveSWEP(player, name, weaponTable)
	return false;
end;

function GM:PlayerSpawnSENT(player, name)
	return false;
end;

function GM:PlayerSpawnNPC(player, npc_type, equipment)
	return false;
end;

function GM:PlayerSpawnedRagdoll(player, model, entity)
	player:AddSandboxLimit("RAGDOLLS", entity);
end;

function GM:PlayerSpawnedProp(player, model, entity)
	player:AddSandboxLimit("PROPS", entity);
end;

function GM:PlayerSpawnedEffect(player, model, entity)
	player:AddSandboxLimit("EFFECTS", entity);
end;

function GM:PlayerSpawnedVehicle(player, entity)
end;

function GM:PlayerSpawnedNPC(player, entity)
end;

function GM:PlayerSpawnedSENT(player, entity)
end;